Skip to content

psimage: fix -B+t>title> issue#9014

Merged
joa-quim merged 2 commits into
masterfrom
fix-5635
May 15, 2026
Merged

psimage: fix -B+t>title> issue#9014
joa-quim merged 2 commits into
masterfrom
fix-5635

Conversation

@joa-quim
Copy link
Copy Markdown
Member

@joa-quim joa-quim commented May 14, 2026

Fix #5635

Assisted-by: Claude Opus 4.7

Fix #5635

Assites-by: Claude Opus 4.7
@joa-quim joa-quim requested a review from a team May 14, 2026 10:47
@Esteban82 Esteban82 added the add-changelog Add PR to the changelog label May 14, 2026
Copy link
Copy Markdown
Member

@Esteban82 Esteban82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works. I got this image with this command:

gmt image @needle.jpg -Dx0/0+w7c -JM12c -JZ14c -p200/30 -B0 -B+w1p+gred3+t"title" -png plot

Image

@joa-quim
Copy link
Copy Markdown
Member Author

And if you do not use -B0 you should see no frame.

@joa-quim
Copy link
Copy Markdown
Member Author

But things are not completely right (and Claude warned me about it). The title is not rotated.

@Esteban82
Copy link
Copy Markdown
Member

But things are not completely right (and Claude warned me about it). The title is not rotated.

Right. I didn't pay attention to that.

@joa-quim
Copy link
Copy Markdown
Member Author

The title angle is now fixed.

This PR now causes test/grdmix/grdmix.sh test to fail. But I think the grdmix.ps baseline is wrong because it misses the frame that is implied by that script using -B0. So, it turns out that apparently we killed two bugs with one stone.

@Esteban82
Copy link
Copy Markdown
Member

The title angle is now fixed.

I'm affraid that I try it and I am getting the same figure.

@joa-quim
Copy link
Copy Markdown
Member Author

Maybe you didn't get the updated branch? Can't retest right now as I'm debugging something else in another branch.

@joa-quim
Copy link
Copy Markdown
Member Author

I checked in another computer and this is working fine. Will merge it but test test/grdmix/grdmix.sh will start to fail because baseline PS is wrong.

@joa-quim joa-quim merged commit f6474f9 into master May 15, 2026
10 of 13 checks passed
@joa-quim joa-quim deleted the fix-5635 branch May 15, 2026 11:33
@Esteban82
Copy link
Copy Markdown
Member

Maybe you didn't get the updated branch? Can't retest right now as I'm debugging something else in another branch.

Yes, I think I had an issue with this. Now, I have this version from today (6.7.0_f6474f9_2026.05.15) and I am getting the same figure that I posted before.

@joa-quim
Copy link
Copy Markdown
Member Author

Not sure I got you you mean. You should get this:

lixo

@Esteban82
Copy link
Copy Markdown
Member

No, I am getting this figure:

Now I tested it on my laptop with windows and I got always the same figure.

Image

This is the GMT version: 6.7.0_f6474f9_2026.05.15

@Esteban82
Copy link
Copy Markdown
Member

Now, I managed to get the title rotated with the script (without -B0):

gmt image @needle.jpg -Dx0/0+w7c -JM12c -JZ14c -p200/30 -B+w1p+gred3+t"title" -png plot2
plot2

Here are both commands that I used to compare:

gmt image @needle.jpg -Dx0/0+w7c -JM12c -JZ14c -p200/30 -B+w1p+gred3+t"title" -B0  -png plot
gmt image @needle.jpg -Dx0/0+w7c -JM12c -JZ14c -p200/30 -B+w1p+gred3+t"title"      -png plot2

@Esteban82
Copy link
Copy Markdown
Member

I looked at the PostScript file generated by this command and I have to say I do not like how it turned out. From what I learned while creating perspective text, when the -p option is used (with 2 values), this translates into the PS applying a transformation matrix that is later reset at the end.

What I see in the PS is that the title was left outside the block affected by the transformation matrix, and instead a rotation was applied directly:

V 10.3141048156 R (title) bc Z U
I suspect that, since a rotation is being applied instead of using the same perspective transformation matrix, the title placement or orientation may not look correct for some parameter values or viewing angles.

@Esteban82
Copy link
Copy Markdown
Member

I suspect that, since a rotation is being applied instead of using the same perspective transformation matrix, the title placement or orientation may not look correct for some parameter values or viewing angles.

For example, I got this figure with this command:
gmt image @needle.jpg -Dx0/0+w7c -JM12c -JZ14c -p190/5 -B+w1p+gred3+t"title" -png plot3

plot3

@Esteban82 Esteban82 added the AI-assisted All (or most) of the code was written by Artificial Intelligence. label May 15, 2026
@joa-quim
Copy link
Copy Markdown
Member Author

Hmmm, maybe right but this also

gmt basemap -R0/10/0/10 -JX12c -JZ14c -p190/5 -B0 -B+t"title" -png lixo
lixo

joa-quim added a commit that referenced this pull request May 16, 2026
A part of the previous fix in #9014 had broken a couple of other tests (oldvec, etc). This now revert that breaking and oddly still fixes the psimage text rotation issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-changelog Add PR to the changelog AI-assisted All (or most) of the code was written by Artificial Intelligence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-B option in image module

2 participants